Finding the exclusive records in a table
Finding the exclusive records in a table
209
27-Jul-2023
Updated on 28-Jul-2023
Aryan Kumar
28-Jul-2023Sure, you can find the exclusive records in a table using the
DISTINCTkeyword and theWHEREclause. The syntax is as follows:SQL
For example, the following SQL statement will find all exclusive records in the
productstable where thepricecolumn is greater than 100:SQL
This will return a list of all unique prices in the
productstable where the price is greater than 100.Here is an example of how to find the exclusive records in a table in MySQL:
SQL
This will return the following result:
As you can see, the
DISTINCTkeyword has returned all unique prices in theproductstable where the price is greater than 100.Here are some additional things to keep in mind when using the
DISTINCTkeyword:DISTINCTkeyword can be used with any column.DISTINCTkeyword will only return unique values.WHEREclause to filter the results of theDISTINCTkeyword.